package com.xiangge.method;

import java.util.Random;
import java.util.Scanner;

public class Lianxi1 {
    public static void main(String[] args) {
    mth();
    }

    public static void mth() {
        System.out.println("请输入班级人数：");
        int classNum = new Scanner(System.in).nextInt();
        if (classNum<=0){
            System.err.println("输入的数据不合法");
            return;
        }
        int[] clazz = new int[classNum];
        for (int i = 0; i < clazz.length; i++) {
            clazz[i] = new Random().nextInt(101);
        }
        int count = 0;
        for (int i : clazz) {
            if (i<60){
                count++;
            }
        }
        System.out.println("不及格的人数：" + count);
        double sum = 0.0;
        for (int i : clazz) {
            sum+=i;
        }
        System.out.println("班级平均分为："+sum/clazz.length);
    }

}
